﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EfSandbox.Entities.Final.Eod.Raw.Mappings {
    public class RawQuoteMap : EntityTypeConfiguration<RawQuote> {
        public RawQuoteMap() {
            ToTable("raw.eod_quotes");

            HasKey(q => q.RawQuoteId);

            Property(q => q.RawQuoteId)
                .HasColumnName("qot_id");

            Property(q => q.SymbolCode)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("qot_sym_cd");

            Property(q => q.ExchangeCode)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("qot_exc_cd");

            Property(q => q.TradeDate)
                .IsRequired()
                .HasColumnName("qot_trade_dt");

            Property(q => q.FrequencyCode)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("qot_period");

            Property(q => q.Open)
                .HasPrecision(18, 6)
                .HasColumnName("qot_open");

            Property(q => q.High)
                .HasPrecision(18, 6)
                .HasColumnName("qot_high");

            Property(q => q.Low)
                .HasPrecision(18, 6)
                .HasColumnName("qot_low");

            Property(q => q.Close)
                .HasPrecision(18, 6)
                .HasColumnName("qot_close");

            Property(q => q.Volume)
                .HasColumnName("qot_volume");

            Property(q => q.OpenInterest)
                .IsOptional()
                .HasColumnName("qot_open_interest");
        }
    }
}
